package ru.amse.stroganova.ui.tool;

import ru.amse.stroganova.ui.GraphComponent;

/**
 * Presents a factory for getting component tools.
 * 
 * @author Dasha Stroganova
 * 
 */
public class ToolFactory {

	private final Tool addEdgeTool;
	
	private final Tool addVertexTool;
	
	private final SelectTool selectTool;
	
	private final DijkstraSelectionTool dijkstraSelectTool;
	
	private final MaxFlowSelectionTool maxFlowSelectionTool;
	
	/**
	 * Creates new tool factory.
	 * 
	 * @param component
	 */
	public ToolFactory(GraphComponent component) {
		addEdgeTool = new AddEdgeTool(component);
		addVertexTool = new AddVertexTool(component);
		selectTool = new SelectTool(component);
		dijkstraSelectTool = new DijkstraSelectionTool(component);
		maxFlowSelectionTool = new MaxFlowSelectionTool(component);
	}
	
	/**
	 * Returns select tool.
	 * 
	 * @return select tool
	 */
	public Tool getSelectTool() {
		selectTool.returnToInitialState();
		return selectTool;
	}
	
	/**
	 * Returns add vertex tool.
	 * 
	 * @return add vertex tool
	 */
	public Tool getAddVertexTool() {
		return addVertexTool;
	}
	
	/**
	 * Returns add edge tool.
	 * 
	 * @return add edge tool
	 */
	public Tool getAddEdgeTool() {
		return addEdgeTool;
	}
	
	/**
	 * Returns Dijkstra selection tool.
	 * 
	 * @return Dijkstra selection tool
	 */
	public Tool getDijkstraSelectionTool() {
		dijkstraSelectTool.returnToInitialState();
		return dijkstraSelectTool;
	}
	
	/**
	 * Returns max flow selection tool.
	 * 
	 * @return max flow selection tool
	 */
	public Tool getMaxFlowSelectionTool() {
		maxFlowSelectionTool.returnToInitialState();
		return maxFlowSelectionTool;
	}
}
